+2005-08-28 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-internal.[ch]: (babl_die): A function to call from
+ babl_fatal (...), invokes commands resulting in a backtrace, thus
+ giving context to where things broke.
+ * babl/babl-component.c: (babl_component_new):
+ * babl/babl-conversion.c: (babl_conversion_new):
+ * babl/babl-fish.c: (babl_conversion_find):
+ * babl/babl-format.c: (format_new), (babl_format_new):
+ * babl/babl-model.c: (babl_model_new):
+ * babl/babl-type.c: (babl_type_new): use babl_fatal() instead of
+ babl_log () on API mistakes.
+
2005-08-28 Øyvind Kolås <pippin@gimp.org>
* babl/babl-pixel-format.c: removed
else
{
- babl_log ("unhandled argument '%s' for format '%s'", arg, name);
- exit (-1);
+ babl_fatal ("unhandled argument '%s' for format '%s'", arg, name);
}
}
}
else
{
- babl_log ("unhandled argument '%s'", arg);
- exit (-1);
+ babl_fatal ("unhandled argument '%s'", arg);
}
arg = va_arg (varg, char *);
if (!data.result)
{
- babl_log ("args=('%s', '%s'): failed, aborting",
- data.source->instance.name, data.destination->instance.name);
- exit (-1);
- return NULL;
+ babl_fatal ("args=('%s', '%s'): failed, aborting",
+ data.source->instance.name,
+ data.destination->instance.name);
}
return data.result;
}
if (component[j] == model->component[i])
goto component_found;
}
- babl_log ("matching source component for %s in model %s not found",
- model->component[i]->instance.name, model->instance.name);
- exit (-1);
+ babl_fatal ("matching source component for %s in model %s not found",
+ model->component[i]->instance.name, model->instance.name);
component_found:
;
}
else
{
- babl_log ("unhandled argument '%s' for format '%s'", arg, name);
- exit (-1);
+ babl_fatal ("unhandled argument '%s' for format '%s'", arg, name);
}
}
*/
int babl_hmpf_on_name_lookups = 0;
+#include <sys/types.h>
+#include <unistd.h>
+
+void
+babl_die (void)
+{
+ char buf[512];
+
+ sprintf (buf,"echo bt>/tmp/babl.gdb;"
+ "gdb -q --batch -x /tmp/babl.gdb --pid=%i 2>/dev/null", getpid());
+ system (buf);
+ exit (-1);
+}
+
void
babl_internal_init (void)
{
#include "babl-extension.h"
/* */
+void babl_die (void);
+
/**** LOGGER ****/
#include <stdarg.h>
#define babl_log(args...) real_babl_log(__FILE__, __LINE__, __FUNCTION__, args)
+#define babl_fatal(args...) \
+ do{ \
+ real_babl_log(__FILE__, __LINE__, __FUNCTION__, args);\
+ babl_die();} \
+ while(0);
+
+
/********************/
#define BABL_CLASS_TYPE_IS_VALID(klass_type) \
return babl; \
}
-#define BABL_DEFINE_LOOKUP_BY_NAME(type_name) \
-Babl * \
-type_name (const char *name) \
-{ \
- Babl *babl; \
- \
- if (babl_hmpf_on_name_lookups) \
- { \
- babl_log ("%s(\"%s\"): hmpf!", __FUNCTION__, name); \
- } \
- babl = db_exist (0, name); \
- \
- if (!babl) \
- { \
- babl_log ("%s(\"%s\"): not found", __FUNCTION__, name); \
- exit (-1); \
- } \
- return babl; \
+#define BABL_DEFINE_LOOKUP_BY_NAME(type_name) \
+Babl * \
+type_name (const char *name) \
+{ \
+ Babl *babl; \
+ \
+ if (babl_hmpf_on_name_lookups) \
+ { \
+ babl_log ("%s(\"%s\"): hmpf!", __FUNCTION__, name); \
+ } \
+ babl = db_exist (0, name); \
+ \
+ if (!babl) \
+ { \
+ babl_fatal ("%s(\"%s\"): not found", __FUNCTION__, name); \
+ } \
+ return babl; \
}
#ifndef BABL_INIT_HOOK
else
{
- babl_log ("unhandled argument '%s' for babl_model '%s'", arg, name);
- exit (-1);
+ babl_fatal ("unhandled argument '%s' for babl_model '%s'", arg, name);
}
arg = va_arg (varg, char *);
else
{
- babl_log ("unhandled argument '%s' for format '%s'", arg, name);
- exit (-1);
+ babl_fatal ("unhandled argument '%s' for format '%s'", arg, name);
}
}